Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.

Windows highdpi2 #1

Closed
wants to merge 42 commits into from
Closed

Windows highdpi2 #1

wants to merge 42 commits into from

Conversation

ericwa
Copy link
Owner

@ericwa ericwa commented Jun 20, 2021

TODO:

  • handle --allow-highdpi on an exe that has "Windows Explorer -> Properties -> Compatibility -> High DPI -> Scaled by Application" set.
  • touch events probably need DPI scaling applied
  • report/send patch for D3D_ActivateRenderer(renderer); after data->updateSize = SDL_TRUE; in SDL_render_3d.c issue
  • prototype "always DPI aware" approach (grab code from first squashed commit on the branch)
  • use SDL's logging categories rather than ifdef's?
  • (2021-11-22): can't go exclusive fullscreen with testwm2 with --allow-highdpi --info all --renderer direct3d11
    • can't repro?
  • (2021-11-21): testgl2 with --allow-highdpi --resizable, 150% monitor. Ctrl+Enter for fullscreen, then Ctrl+Enter to exit fullscreen. Window is too small
    • fixed by putting a break; at the start of the WM_DPICHANGED handler
    • edit: this didn't actually fix it
    • --renderer direct3d11 seems to resolve this though? DX9 only?
    • actual fix: call D3D_ActivateRenderer(renderer); after data->updateSize = SDL_TRUE; in SDL_render_3d.c
  • Fullscreen (Ctrl+Enter in testwm2) on 2 monitor setup, 125% and 100%, goes fullscreen on wrong window. Also happens on main
    • also both monitors seem to change modes, when only 1 should
    • 2021-11-06: can't seem to reproduce going fullscreen on the wrong window in this case, but it goes into the wrong fullscreen mode as displayed by the monitor's OSD (1280x740), window before going fullscren is 640x480 points (800x600 pixels) on 3840x2160 px 125% monitor.
  • testwm2 with --allow-highdpi --info all on 3840x2160 px @ 125% monitor. Alt+Enter gives the following - shouldn't Window size be 3072x1728 points, and the mouse position is also in pixels not points. (global mouse pos is in points though!)
    image
  • (2021-11-21): testgl2 with --allow-highdpi, 150% monitor, renders like: image
    • calling data->SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
    • data->AreDpiAwarenessContextsEqual(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2, data->GetThreadDpiAwarenessContext()) was returning true
    • fixed by changing SetThreadDpiAwarenessContext call to SetProcessDpiAwarenessContext. Apparently the OpenGL driver (nvidia) needs the process DPI awareness set?

Notes:

Testing matrix:

  • render / video backends:
    • testwm2 --renderer direct3d11
    • testwm2 --renderer direct3d
    • testwm2 --renderer opengl
    • testgl2
    • testvulkan
    • testgles2
  • DPI awareness levels
    • unaware
    • system
    • per-monitor
    • per-monitor V2

@ericwa ericwa marked this pull request as draft November 7, 2021 03:28
@ericwa ericwa force-pushed the windows-highdpi2 branch 2 times, most recently from a09a262 to f7e89a8 Compare November 23, 2021 06:41
@ericwa ericwa force-pushed the windows-highdpi2 branch 3 times, most recently from 37b4b90 to 3125a0a Compare December 4, 2021 21:41
@ericwa ericwa force-pushed the windows-highdpi2 branch from 3f6d640 to b294970 Compare March 6, 2022 02:58
@ericwa ericwa force-pushed the windows-highdpi2 branch from b294970 to b298013 Compare March 10, 2022 07:14
@ericwa
Copy link
Owner Author

ericwa commented Jun 23, 2022

Merged into main via libsdl-org#5778

@ericwa ericwa closed this Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant